package com.intellij.ide.license.impl;

import com.intellij.licensecommon.data.LicenseData;

import java.util.Date;

/**
 * 评估 license
 */
public class EvaluationLicense implements LicenseData {
    public static final String NAME = "Evaluation";
    private final long time;
    private final Date generationDate;
    private final int licenseType;
    private boolean e = true;
    private boolean f = false;
    private final int productVersion;
    private final String username;

    public EvaluationLicense(Date generationDate, int productVersion, String username, int licenseType, int days) {
        this.generationDate = generationDate;
        this.licenseType = licenseType;
        this.time = (days * 24 * 3600 * 1000L);
        this.productVersion = productVersion;
        this.username = username;
    }

    @Override
    public boolean isAccepted() {
        return this.e;
    }

    @Override
    public void setAccepted(boolean accepted) {
        this.e = accepted;
    }

    @Override
    public String getKey() {
        return "";
    }

    @Override
    public boolean isEvaluationExpired(Date paramDate) {
        long l = paramDate.getTime() - this.generationDate.getTime();
        return l > this.time;
    }

    @Override
    public boolean isValid() {
        return true;
    }

    @Override
    public boolean isFromUser() {
        return this.f;
    }

    @Override
    public boolean willExpire() {
        return true;
    }

    @Override
    public Date getExpirationDate() {
        return new Date(this.generationDate.getTime() + this.time);
    }

    @Override
    public String getUsername() {
        return this.username;
    }

    @Override
    public boolean isAcademic() {
        return false;
    }

    @Override
    public boolean i() {
        return false;
    }

    @Override
    public boolean isPersonal() {
        return false;
    }

    @Override
    public boolean k() {
        return false;
    }

    @Override
    public boolean isClassroom() {
        return false;
    }

    @Override
    public boolean isOpenSource() {
        return false;
    }

    @Override
    public int getMajorVersion() {
        return this.productVersion;
    }

    @Override
    public Date getGenerationDate() {
        return this.generationDate;
    }

    @Override
    public void setFromUser(boolean paramBoolean) {
        this.f = paramBoolean;
    }

    @Override
    public int getLicenseType() {
        return this.licenseType;
    }
}
